% cost--weighted cdf of markups
clear diff

%subplot(1,3,1)
markup = eq_SS.pf.*exp(glob.sf(:,2));
[M,I] = sort(markup);
L = eq_SS.L(I);

y = randsample(length(L),1e6,'true',L);
y = markup(y);
[f, xi] = ksdensity(y);
bar(xi,f);

F = cumsum(L)/sum(L);
F = diff(F);

%plot(M(2:end),F,'LineWidth',4);
title('Dist. of Markups')
set(gca,'YTickLabel',[]);
% subplot(1,3,2)
% sales = eq_SS.pf.*eq_SS.yf;
% [M,I] = sort(sales);
% L = eq_SS.L(I);
% 
% y = randsample(length(L),1e6,'true',L);
% y = sales(y);
% [f, xi] = ksdensity(y);
% 
% bar(xi,f);
% 
% 
% F = cumsum(L)/sum(L);
% F = diff(F);
% 
% %plot(M(2:end),F,'LineWidth',4);
% title('Dist. of Sales')
% set(gca,'YTickLabel',[]);
% 
% subplot(1,3,3)
% emp = eq_SS.l;
% [M,I] = sort(emp);
% L = eq_SS.L(I);
% 
% F = cumsum(L)/sum(L);
% F = diff(F);
% 
% y = randsample(length(L),1e6,'true',L);
% y = emp(y);
% [f, xi] = ksdensity(y);
% bar(xi,f);
% 
% 
% %plot(M(2:end),F,'LineWidth',4);
% title('Dist. of Employment')
% set(gca,'YTickLabel',[]);
print('-dpng', 'figures/distributions.png');
